﻿<sap:ActivityDesigner x:Class="WFT.Activities.Designers.ForDesigner"
    x:Uid="ForDesigner"
     xmlns:s="clr-namespace:System;assembly=mscorlib"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
    xmlns:sadv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
   xmlns:wft="clr-namespace:WFT.Activities.Designers"
   xmlns:sadc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" Loaded="ActivityDesigner_Loaded">
    <sap:ActivityDesigner.Resources>
        <ResourceDictionary x:Uid="ResourceDictionary1">
            <sadc:ArgumentToExpressionConverter x:Uid="sadv:ArgumentToExpressionConverter_1" x:Key="argumentToExpressionConverter" />
            <wft:ForOperatorConvertor x:Uid="forOperatorConvertor" x:Key="forOperatorConvertor" />
            <DataTemplate x:Uid="DataTemplate1" x:Key="ExpandedCommentOutTemplate">
                <Grid x:Uid="Grid1" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition x:Uid="row1" />
                        <RowDefinition x:Uid="row2" />
                        <RowDefinition x:Uid="row3" />
                    </Grid.RowDefinitions>
                    <StackPanel x:Uid="stackPanel" Grid.Row="0" Orientation="Horizontal">
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0">for(int</TextBlock>
                        <TextBox Height="16" x:Uid="argumentNameBox" Name="argumentNameBox" AutomationProperties.AutomationId="ArgumentName"
                            AutomationProperties.Name="Proxy"
                            Width="25"  Margin="3,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center"
                            Text="{Binding Path=ModelItem.Body.Argument.Name, Mode=TwoWay, ValidatesOnExceptions=True}"/>
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1">=</TextBlock>
                        <sadv:ExpressionTextBox  Name="initialValue" Height="23"
                                Expression="{Binding Path=ModelItem.InitialVariableValue, Mode=OneWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                                ExpressionType="{x:Type TypeName=s:Int32}" IsReadOnly="True" OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1">;</TextBlock>
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"  Text="{Binding Path=ModelItem.Body.Argument.Name, Mode=OneWay}" />
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1" Text="{Binding Path=ModelItem.ConditionOperator, Mode=OneWay,  Converter={StaticResource forOperatorConvertor}}" />
                        <sadv:ExpressionTextBox  Name="conditionValue" Height="23"
                                Expression="{Binding Path=ModelItem.ConditionValue, Mode=OneWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                                ExpressionType="{x:Type TypeName=s:Int32}" IsReadOnly="True" OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1">;</TextBlock>
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0"  Text="{Binding Path=ModelItem.Body.Argument.Name, Mode=OneWay}" />
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1"> += </TextBlock>
                        <sadv:ExpressionTextBox  Name="varIncrement" Height="23"
                                Expression="{Binding Path=ModelItem.VariableIncrement, Mode=OneWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                                ExpressionType="{x:Type TypeName=s:Int32}" IsReadOnly="True" OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                        <TextBlock x:Uid="textBlock" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1">)</TextBlock>
   
                    </StackPanel>
                    <TextBlock Margin="0,10,0,7" Text="Body" x:Uid="labelBody"  Grid.Row="1" />
                    <Border x:Uid="groupBox1" Grid.Row="2" CornerRadius="2" BorderThickness ="1" BorderBrush="#cecece">
                        <sap:WorkflowItemPresenter
                         x:Uid="sad:workflowItemPresenter1" AutomationProperties.AutomationId="Activity"
                        IsDefaultContainer="True"
                HintText="Drop activity here"
                Item="{Binding Path=ModelItem.Body.Handler, Mode=TwoWay}"
                AllowedItemType="{x:Type sa:Activity}"
                MinWidth="100" MinHeight="100" Margin="7" />
                    </Border>
                </Grid>
            </DataTemplate>
            <DataTemplate x:Uid="dataTemplate" x:Key="CollapsedActivityViewTemplate">
                <Label x:Uid="textBlockClick" Padding="0,0,0,0" FontStyle="Italic"
                       Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center"
                       VerticalAlignment="Center">Double-click to view</Label>
            </DataTemplate>
            <Style x:Uid="style" x:Key="ProxyStyle" TargetType="{x:Type ContentPresenter}">
                <Setter x:Uid="setter1" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />
                <Style.Triggers>
                    <DataTrigger x:Uid="trigger" Binding="{Binding Path=ShowExpanded}" Value="true">
                        <Setter x:Uid="setter2" Property="ContentTemplate" Value="{DynamicResource ExpandedCommentOutTemplate}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </sap:ActivityDesigner.Resources>
    <ContentPresenter x:Uid="contentPresenter" Style="{DynamicResource ProxyStyle}" Content="{Binding}" />
</sap:ActivityDesigner>
